package com.baidu.shoppingmall.role.service.Impl;


import com.baidu.shoppingmall.role.dao.RoleDao;
import com.baidu.shoppingmall.role.domain.RoleDTO;
import com.baidu.shoppingmall.role.domain.RolePO;
import com.baidu.shoppingmall.role.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class RoleServiceImpl extends ServiceImpl<RoleDao, RolePO> implements RoleService {

    @Autowired
    private RoleDao roleDao;

    @Override
    public List<RoleDTO> queryRole(String id) {
        List<RolePO> rolePOList = roleDao.queryRole(id);
        List<RoleDTO> roleDTOList = new ArrayList<>();
        rolePOList.forEach(po->roleDTOList.add(po.clone(RoleDTO.class)));
        return roleDTOList;
    }
}
